package qdu.rgzb23.ch6_miscs;

import android.annotation.SuppressLint;
//import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import java.util.Random;

@SuppressLint("ValidFragment")
public class Myfragment extends Fragment {
	private String content;
    private int i;
    int colors[] = {Color.RED,Color.GREEN,Color.BLUE,Color.CYAN,Color.YELLOW,Color.BLACK};
    @SuppressLint("ValidFragment")
    public Myfragment(String content, int i) {
        this.content = content; this.i = i;
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fg_content,container,false);
        TextView txt_content = (TextView) view.findViewById(R.id.txt_content);
        txt_content.setText(content);

        txt_content.setBackgroundColor(colors[i]);
        return view;
    }
}
